package com.example.demo.system.controller;

import com.example.demo.system.entity.RotationChart;
import com.example.demo.system.service.RotationChartService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.Valid;
/**
* @author 许久龙
* @since 2022-02-19
*/
@RestController
@RequestMapping("api")
public class RotationChartController {

    @Autowired
    private RotationChartService rotationChartService;

    @GetMapping("/rotation-chart")
    @ApiOperation("RotationChart查询单个")
    public ResultVO getRotationChart(@RequestBody RotationChart rotationChart){
     ResultVO resultVO = rotationChartService.getRotationChart(RotationChart rotationChart);
     return  resultVO;
   }

    @GetMapping("/rotation-chart")
    @ApiOperation("RotationChart查询全部")
    public ResultVO getAllRotationChart(){
        ResultVO resultVO = rotationChartService.getAllRotationChart();
        return  resultVO;
    }

    @PostMapping("/rotation-chart")
    @ApiOperation("RotationChart新增")
    public ResultVO add(@Valid @RequestBody RotationChart rotationChart) {
        ResultVO resultVO = rotationChartService.add(RotationChart rotationChart);
        return  resultVO;
    }

    @PutMapping("/rotation-chart")
    @ApiOperation("RotationChart修改")
    public ResultVO update(@Valid @RequestBody RotationChart rotationChart) {
        ResultVO resultVO = rotationChartService.update(RotationChart rotationChart);
        returnresultVO;
    }


    @DeleteMapping(value = "/rotation-chart/{ids}")
    @ApiOperation("RotationChart删除(单个条目)")
    public ResultVO remove(@NotBlank(message = "{required}") @PathVariable String ids) {
        ResultVO resultVO = rotationChartService.remove(String ids);
        return resultVO;
    }
}
